//
//  WaterFallCollectionCell.m
//  FNMenu
//
//  Created by 航汇聚科技 on 2018/9/5.
//  Copyright © 2018年 Yi Zhou. All rights reserved.
//

#import "WaterFallCollectionCell.h"
#import <SDWebImage/UIImageView+WebCache.h>
#import "NSDictionary+Safety.h"
@interface WaterFallCollectionCell ()
@property (weak, nonatomic) IBOutlet UIImageView *imgView;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *descLabel;
@property (weak, nonatomic) IBOutlet UILabel *browserNumberLabel;
@property (weak, nonatomic) IBOutlet UILabel *collectNumberLabel;

@end

@implementation WaterFallCollectionCell

- (void)layoutSubviews {
    [super layoutSubviews];
    self.imgView.layer.shadowColor = [UIColor lightGrayColor].CGColor;
    self.imgView.layer.shadowOffset = CGSizeMake(2, 2);
    self.imgView.layer.shadowRadius = 3;
    self.imgView.layer.shadowOpacity = .7;
    //self.imgView.layer.cornerRadius = 4;
}

- (void)setFoodInfo:(NSDictionary *)foodInfo {
    _foodInfo = foodInfo;
    [self.imgView sd_setImageWithURL:[NSURL URLWithString:[foodInfo safeObjectForKey:@"albums"][0]] placeholderImage:[UIImage imageNamed:@""] completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
        
    }];
    self.nameLabel.text = [foodInfo safeObjectForKey:@"title"];
    self.descLabel.text = [foodInfo safeObjectForKey:@"tags"];
    
    NSInteger browserNumber = [[foodInfo safeObjectForKey:@"browse"] integerValue];
    NSInteger collectNumber = [[foodInfo safeObjectForKey:@"collect"] integerValue];
    if (browserNumber > 10000) {
    }
    
    self.browserNumberLabel.text = [NSString stringWithFormat:@"%ld",browserNumber];
    self.collectNumberLabel.text = [NSString stringWithFormat:@"%ld",collectNumber];
}

@end
